<?php


/** @see Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';

/**
 * Controleur d'action principal
 */
class GridController extends Zend_Controller_Action
{

    /**
     * Simple use of datagrid
     */
    public function indexAction()
    {
        //$this->bAction();
    }

    public function viewAction()
    {
        //see the view script file
    }

    public function aAction()
    {
        //set the name of datagrid when creating the grid object
        // the name for each datagrid is oblige
        $grid = new Zend_DataGrid('gridName');

        //assign to the view
        $this->view->grid = $grid;
    }

    public function bAction()
    {
        //or use the option array
        $options = array('name' => 'gridName',
                         'allowSorting' => true,
                         'urrentPage' => 1,
                         'editItemIndex' => 1,
                         //'assocColumns' => $assocColumns
                         //'columns' => $columns,
                         //'datasource' => $datasource,
                         //'dataSourceOptions' => $dataSourceOptions,
                         'selectedItemIndex' => 1,
                         'options' => array('name' => 'gridName'),
                         'renderer' => array(
                            'xhtml' => array(),
                            'xml' => array()
                         )
                   );

        //creating the datagrid object
        $grid = new Zend_DataGrid($options);

        //assign to the view
        $this->view->grid = $grid;
    }

    public function cAction()
    {
        //or use the option array
        $otherOpions = array('' => '');

        //creating the datagrid object
        $grid = new Zend_DataGrid('gridName', $otherOpions);

        $this->view->grid = $grid;
    }

    public function dAction()
    {
        $options = array('name' => 'gridName');

        //or use Zend_Config object
        $config = new Zend_Config($options);

        //creating the datagrid object
        $grid = new Zend_DataGrid($config);

        $this->view->grid = $grid;
    }

    public function eAction()
    {
        $options = array('name' => 'gridName');

        //or use Zend_Config object
        $config = new Zend_Config($options);

        //creating the datagrid object
        $grid = new Zend_DataGrid('gridName', $config);

        $this->view->grid = $grid;
    }

}
